package com.itheima.prize.commons.enums;

import lombok.Getter;

@Getter
public enum ResultCodeEnum {

    Failure("0","业务不成功"),
    SUCCESS("1","成功"),
    FAIL("-1","失败"),
    SUCCESS_STATUS("200","成功");

    // 状态码
    public final String code;
    // 描述
    public final String desc;

    ResultCodeEnum(String code, String desc){
        this.code = code;
        this.desc = desc;
    }

    public static ResultCodeEnum getByCode(String codeVal){
        for(ResultCodeEnum resultCodeEnum : ResultCodeEnum.values()){
            if(resultCodeEnum.code.equals(codeVal)){
                return resultCodeEnum;
            }
        }
        return null;
    }

}
